const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  transpileDependencies: true,
  productionSourceMap: false,
  publicPath: "./",
  outputDir: "dist", //打包时生成的生产环境构建文件的目录
  assetsDir: "public",
  indexPath: "index.html",
  lintOnSave: false,
  devServer: {
    host: "0.0.0.0",
    port: "3004",
    // proxy: "http://localhost:3003/",
    proxy: {
      "/socket.io": {
        target: "http://localhost:3000",
        ws: true,
        changeOrigin: true,
      },
    },
  },
  // proxy: {
  //   "/socket.io": {
  //     target: "http://localhost:3000",
  //     ws: true,
  //     changeOrigin: true,
  //   },
  // },
  //全局 sass的配置
  chainWebpack(config) {
    globalSass(config);
  }
});
const globalSass = (config) => {
  const oneOfsMap = config.module.rule("scss").oneOfs.store;
  oneOfsMap.forEach((item) => {
    item
      .use("sass-resources-loader")
      .loader("sass-resources-loader")
      .options({
        resources: "./src/scss/handle.scss" //相对路径
      })
      .end();
  });
};
